<?php
session_start();
$username = $_REQUEST['username'];
$password = md5($_REQUEST['password']);

include '../sql/conn.php';

$sql = "select * from user where uname='$username' and pass='$password'";
$result = mysql_query($sql);
$hasil = mysql_fetch_array($result);

if (!empty($hasil['uname'])){
    $_SESSION['userbkknt']=$hasil['uname'];
    define("USER","$_SESSION[userbkknt]");
    header('location:../');
} else {
    ?>
    <head>
	<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="../themes/icon.css">
	<script type="text/javascript" src="../js/jquery-1.7.1.min.js"></script>
	<script type="text/javascript" src="../js/jquery.easyui.min.js"></script>
        <script type="text/javascript">
            jQuery(document).ready(function(){
                $.messager.alert('Login Gagal!','Username / Password Anda Salah!','info',function(){
                    document.location.href='../';
                });
            });
        </script>
    </head>
    <?php
}
?>